<!-- 商家管理 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label mb10">
            商家列表
        </p>
        <div>
            <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
                sonRouter="xqEditingShop"></dxtable>
        </div>
    </div>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf } from "../../util/index";
import { h, ref, reactive } from "vue";
const props = defineProps({
    pup: { type: String },
});
let headBtn = [];
const databale = ref();
const initeer = () => {
    databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
const classifyoptions = ref()
const gysList = ref()
// 弹窗公用该列表

let dataJson = reactive([

    {
        title: "店铺名称",
        search: true, // 是否在搜索栏展示
        key: "name",
        render(row) {
            return h('span',{class:"sz "+(row.auditStatus==2?'ls':''),onClick:()=>{
                if(row.auditStatus!=2){
                    window.$message.error("请联系管理审核通过才能上架商品！")
                    return
                }
                hf("xqproductList",{id:row.id,shopNmae:row.name})
            }},row.name)
        },
    },
    {
        title: "供应商",
        key: "scopeServices",
        render(row){
           try{
            return  gysList.value.filter((a)=>a.value==row.supplier)[0].label
           }catch(e){

           }
        }
    },
   
    {
        title: "审核状态",
        key: "auditStatus",
        type:"select",
        search: true, // 是否在搜索栏展示
        options:[
            {
                label:"全部",
                value:""
            }, {
                label:"等待审核",
                value:"1"
            }, {
                label:"审核通过",
                value:"2"
            }, {
                label:"审核不通过",
                value:"3"
            }
        ],
        render(row){
            if(row.auditStatus==1){
                return h("span",{class:""},"审核中")
            }
            if(row.auditStatus==2){
                return h("span",{class:"ls"},"审核通过")
            }
            if(row.auditStatus==3){
                return h("span",{class:"z9"},"审核不通过("+row.AuditRemarks+")")
            }
        }
       
    },
    {
        title: "排序",
        width: 100,
        render(row) {
            row.databaseName = "xqshop";
            return h(sort, {
                row,
                onCallBack: () => {
                    initeer();
                },
            });
        },
    },
    {
        title: "创建时间",
        key: "addTime",
        width: "200",
        type: "daterange",
    },
]);
let portUrl = "xqts/xqshop";
const qx = {
    DeletePermissionID: "xqsupplierdel", //删除
    EditPermissionIdentifier: "xqsupplierbj", // 编辑
    NewPermissionIdentifier: "xqsupplierxz", // 新建
    ViewPermissionID: "xqsupplierck", // 查看
};


let pupVal = props.pup;
if (pupVal) {
    headBtn = [
        {
            name: "确认选择 ",
            async clickFun(row) {
                const arrList = row.join(",");
                emit("callBack", arrList);
            },
        },
    ];



}
// const getcyyxconfig = async () => {
//     const { data }: any = await dxget('xqts/getarea')
//     classifyoptions.value = data
// }
// getcyyxconfig()
// const getarea = async () => {
//     const { data }: any = await dxget('public/area')
//     dataJson[1].options= data
// }
// getarea()

const getgys = async()=>{
   const {data}:any =  await dxget("xqts/RegionalSupplier/getgys")
   gysList.value = data

}
getgys()



</script>


